<template>
  <div class="navbar navbar-inverse-blue navbar">
      <!-- <div class="navbar navbar-inverse-blue navbar-fixed-top"> -->
      <div class="navbar-inner">
        <div class="container">
          <div class="navigation">

          </div>
          <a class="brand" href="index.html"><img src="../../static/images/logo.png" alt="logo"></a>
          <div class="pull-right">
            <nav class="navbar nav_bottom" role="navigation">
              <!-- Brand and toggle get grouped for better mobile display -->
              <div class="navbar-header nav_2">
                <button type="button" class="navbar-toggle collapsed navbar-toggle1" data-toggle="collapse" data-target="#bs-megadropdown-tabs">Menu
                  <span class="sr-only">Toggle navigation</span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#"></a>
              </div>
              <!-- Collect the nav links, forms, and other content for toggling -->
              <div class="collapse navbar-collapse" id="bs-megadropdown-tabs">
                <ul class="nav navbar-nav nav_1">
                  <li><router-link to="/index">首页</router-link></li>
                  
                  <li><a href="about.html">约会</a></li>
                  <li><router-link to="/school">恋爱学堂</router-link></li>
                  <li><a href="about.html">红娘</a></li>
                  <li><router-link to="/my">我的</router-link></li>
                  <li>
                    <nav id="colorNav">
                      <ul>
                        <li class="green">
                          <a href="#" class="icon-home"></a>
                          <ul>
                            <li><router-link to="/login">登录</router-link></li>
                            <li><router-link to="/register">注册</router-link></li>
                            <li @click="logout"><router-link to="">注销</router-link></li>
                          </ul>
                        </li>
                      </ul>
                    </nav>
                  </li>
                </ul>
              </div><!-- /.navbar-collapse -->
            </nav>
          </div> <!-- end pull-right -->
          <div class="clearfix"> </div>
        </div> <!-- end container -->
      </div> <!-- end navbar-inner -->
    </div>
</template>

<script>
import Axios from 'axios'
export default {
  methods:{
    logout(){
      Axios({
        url:this.$api+'api/user/logout/',
        method:'get',
        withCredentials:true,
      }).then((res)=>{
        console.log(res.data)
        if(res.data.code==0){
          alert('注销成功')
        }
        if(res.data.code==4014){
          alert("您还未登录哦")
        }
      })
    }
  }
}
</script>

<style>

</style>
